/*
 * @version: 
 * @Author: yu
 * @Date: 2023-07-12 14:28:01
 * @LastEditors: Andy
 * @LastEditTime: 2023-07-12 14:38:55
 */
import { roleList } from '@/request/api'


//封装一个接口数据类型
interface stateRole {
    list: Array<Object>
}


const state = {
    list: []
}

const getters = {
    getRole(state: stateRole) {
        return state.list
    }
}


const mutations = {
    mutationsList(state: stateRole, payload: any) {
        state.list = payload
    }
}

const actions = {
    listActions(context: any) {
        roleList().then((res: any) => {
            // console.log(res);
            context.commit('mutationsList', res.list)

        })
    }
}


export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}